// 品类管理相关类型
export interface Category {
  categoryId: string
  categoryName: string
  categoryType: string
  categoryKey: string
  createTime: string
}

export interface CategoryFormData {
  categoryId?: string
  categoryName: string
  categoryType: string
  categoryKey: string
}

export interface CategorySearchForm {
  categoryName: string
  categoryType: string
  categoryKey: string
}

// 产品管理相关类型
export interface Product {
  productId: string
  productCode: string
  productName: string
  categoryId: string
  nodeType: string
  networkProtocolType: string
  description: string
}

export interface ProductFormData {
  productId?: string
  productCode: string
  productName: string
  categoryId: string
  nodeType: string
  networkProtocolType: string
  description: string
}

export interface ProductSearchForm {
  productName: string
  categoryId: string
  nodeType: string
  networkProtocolType: string
}

// 协议列表相关类型
export interface Protocol {
  communicationProtocolId: string
  productName: string
  protocolVersionNumber: string
  protocolVersionName: string
  status: string
  communicationProtocolType: string
}

export interface ProtocolFormData {
  communicationProtocolId?: string
  productName: string
  protocolVersionNumber: string
  protocolVersionName: string
  status: string
  communicationProtocolType: string
}

export interface ProtocolSearchForm {
  productName: string
  protocolVersionNumber: string
  protocolVersionName: string
  communicationProtocolType: string
}

// 数据格式管理相关类型
export interface DataFormat {
  dataFormatId: string
  name: string
  requestType: string
  direction: number // 0为请求，1为响应
  messageType: string
  dataformatType: string
  command: string
  testStatus: number // 0为否，1为是
  status: string
  remark?: string
}

export interface DataFormatFormData {
  dataFormatId?: string
  name: string
  requestType: string
  direction: number // 0为请求，1为响应
  messageType: string
  dataformatType: string
  command: string
  testStatus: number // 0为否，1为是
  status: string
  remark?: string
}

export interface DataFormatSearchForm {
  name: string
  requestType: string
  protocolId: string
}

// 配置属性管理相关类型
export interface ConfigAttribute {
  id: string
  attributeName: string
  attributeIdentifier: string
  attributeNumber: string
  attributeDataType: string
  valueRange: string
  attributeUnit: string
  minValue?: number
  maxValue?: number
}

export interface ConfigAttributeFormData {
  id?: string
  attributeName: string
  attributeIdentifier: string
  attributeNumber: string
  attributeDataType: string
  valueRange: string
  attributeUnit: string
  minValue?: number
  maxValue?: number
}

export interface ConfigAttributeSearchForm {
  attributeName: string
  attributeIdentifier: string
  attributeDataType: string
}

// 通用类型
export interface PaginationData {
  current: number
  pageSize: number
  total: number
}

export interface ApiResponse<T = any> {
  code: number
  message: string
  data: T
}

// 枚举类型
export enum CategoryType {
  SENSOR = 'sensor',
  ACTUATOR = 'actuator',
  GATEWAY = 'gateway',
  CONTROLLER = 'controller'
}

export enum NodeType {
  DEVICE = 'device',
  GATEWAY = 'gateway',
  EDGE = 'edge'
}

export enum NetworkProtocolType {
  WIFI = 'wifi',
  ETHERNET = 'ethernet',
  BLUETOOTH = 'bluetooth',
  ZIGBEE = 'zigbee',
  LORA = 'lora'
}

export enum CommunicationProtocolType {
  MQTT = 'mqtt',
  COAP = 'coap',
  HTTP = 'http',
  TCP = 'tcp',
  UDP = 'udp'
}

export enum RequestMethod {
  GET = 'GET',
  POST = 'POST',
  PUT = 'PUT',
  DELETE = 'DELETE'
}

export enum CommunicationDirection {
  UPLINK = 'uplink',
  DOWNLINK = 'downlink',
  BIDIRECTIONAL = 'bidirectional'
}

export enum MessageType {
  COMMAND = 'command',
  DATA = 'data',
  EVENT = 'event',
  RESPONSE = 'response'
}

export enum DataFormatType {
  JSON = 'json',
  XML = 'xml',
  BINARY = 'binary',
  TEXT = 'text'
}

export enum DataParsingMethod {
  AUTOMATIC = 'automatic',
  MANUAL = 'manual',
  SCRIPT = 'script'
}

export enum AttributeDataType {
  STRING = 'string',
  INTEGER = 'integer',
  FLOAT = 'float',
  BOOLEAN = 'boolean',
  ARRAY = 'array',
  OBJECT = 'object'
}